<section>
    <div class="page_title">
        <h2 class="fl">收到的站内信</h2>
        <a class="fr top_rt_btn iconfont iconfont-fasong" href="{:U('admin/Msgtext/addMessage')}">发送站内信</a>
    </div>
    <ul class="admin_tab">
        <li><a class="loadContent" href="{:U('admin/Msgtext/index')}">我发出的站内信</a></li>
        <li><a class="active loadContent" href="{:U('admin/Msgtext/recmessage')}">收到的站内信</a></li>
    </ul>
    <!--tabCont-->
    {empty name="recmsg"}
    <!--<div class="admin_tab_cont" style="display: none;">-->
        <div class="not-data">你还没有收到站内信哟！</div>
    <!--</div>-->
    {else /}
    <table class="table">
        <tbody>
        <tr>
            <th>状态</th>
            <th>发送人</th>
            <th>站内信标题</th>
            <th>收信时间</th>
            <th>操作</th>
        </tr>
        {volist name='recmsg' id='v'}
        <tr>
            <td>{eq name="v.state" value="1"}<div style="color: #339900">【未读】</div>{else/}<div style="color: #b2b2b2">【已读】</div>{/eq}</td>
            <td>{$v.msgText.creater}</td>
            <td>{$v.msgText.title}</td>
            <td>{$v.create_time|date='Y-m-d H:i', ###}</td>
            <td>
                <div class="action-buttons">
                    <a class="loadContent inner_btn" href="{:U('admin/Msgtext/readMsg',array('id'=>encrypt_id($v.msg_id)))}">
                        查看
                    </a>
                    <a class="delMsg loadContent inner_btn" href="javascript:void(0)" data-id="{:encrypt_id($v.id)}">
                        删除
                    </a>
                </div>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
        <aside class="paging">
            {$recpage.html}
        </aside>
    {/empty}
</section>
<script type="text/javascript">
    $(".delMsg").click(function(){
        var id = $(this).data('id');
        msg({
            yes:'删除',
            no:'取消',
            txt:'确认删除?',
        },'question').then(function() {
            var send_data = {
                url:U('admin/Msgtext/delMsg'),
                type:'POST',
                data:{
                    id:id
                },
                dataType:'json',
            };
            send_ajax(send_data,function(response){
                if(response === false){
                    DEBUG && admin.log(ajax_error);
                    return false;
                }
                if(response.status == 1){
                    msg_success(response.data.info,'',1000);
                    setTimeout(function(){
                        admin.getContentByUrl(response.data.jumpurl);
                    },1000);
                }else{
                    msg_error(response.message);
                }
                admin.log(response);
            });
        }, function(miss) {
            //dismiss can be 'cancel', 'overlay', 'close', 'timer'
            //if (miss === 'cancel') {
            //msg('你取消了')
            //}
        });
    });
</script>